package com.shilei.c05_1_ThreadLocalAndRefType;

import java.util.concurrent.TimeUnit;

/**
 * @description:
 * @author: 81271
 * @date: 2020-06-20 15:13
 */
public class TestThreadLocal1 {
    volatile static Person person = new Person();

    public static void main(String[] args) {
        new Thread(() -> {
            try {
                TimeUnit.SECONDS.sleep(2);
                System.out.println(person.name);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }).start();

        new Thread(() -> {
            try {
                TimeUnit.SECONDS.sleep(1);
                person.name = "ooxx";
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }).start();
    }




}

class Person{
    String name = "xxoo";
}


